<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>{:session('cp.cpsysname')}--商户管理平台</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <meta name="description" content="{:config('webconfig.description');}">
    <meta name="keywords" content="{:config('webconfig.keywords');}">
    <meta name="author" content="runoob">
    <link rel="stylesheet" href="__STATIC_URL__/static/css/bootstrap.css">
    <link rel="stylesheet" type="text/css" href="__STATIC_URL__/static/css/index.css"/>
    <link rel="stylesheet" type="text/css" href="__STATIC_URL__/static/member/css/core.css"/>
    <link rel="stylesheet" type="text/css" href="__STATIC_URL__/static/member/css/member-info.css"/>
    <link rel="stylesheet" type="text/css" href="__STATIC_URL__/static/css/bootstrap-datetimepicker.css"/>
    <script src="__STATIC_URL__/static/js/jquery-2.1.4.min.js"></script>
    <script src="__STATIC_URL__/static/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <script src="__STATIC_URL__/static/js/commen.js" type="text/javascript" charset="utf-8"></script>
    <script src="__STATIC_URL__/static/js/bootstrap-datetimepicker.js" type="text/javascript" charset="utf-8"></script>
    <style>
        thead tr th{-
        text-align: center;
        }
        tbody tr td{
            text-align: center;
        }
        .modal-body .nav>li>a {
            position: relative;
            display: block;
            padding: 3px 15px;
            background: #d8d8d8;
        }
        .modal-body .nav>li>a:hover{
            background: #d8d8d8;
        }
        a{ text-decoration:none}
        .btn-link:hover, .btn-link:focus {
            text-decoration: none;
        }
        a:hover {text-decoration:none}
        a:link {
            text-decoration: none;
        }
        a:visited {
            text-decoration: none;
        }
        a:active {
            text-decoration: none;
        }
        .modal-body  .nav> li.active > a::before {
            width: 0;
            height: 0;
            border-left: 8px solid transparent;
            border-right: 8px solid transparent;
            border-top: 8px solid #d8d8d8;
            content: " ";
            position: absolute;
            right: 50%;
            bottom: -8px;
            margin-right: -8px;
            z-index: 2;
        }
        .info-row{
            line-height: 32px;
            color: #333;
        }
        .info-row label{
            padding-left: 15px;
            padding-right: 15px;
        }
        .r-title{
            color: #333;
        }
        .panel .panel-body {
            padding:0px;
        }
        .pagecount{
            text-align: center;
            margin-bottom: 5px;
            padding:15px 15px 20px 0;
        }
        .pagecount span{
            display: inline-block;
            background: #ddd;
            margin:0 0 0 5px;
            width:80px;
            text-align: center;
            padding:2px 8px 2px 8px;
            border:1px solid #eee;
            color: #666;
        }
        .pagecount span a{
            color:#333;
        }
        .pagecount span a:hover{
            text-decoration: underline;
        }
        .thumb-sm {
            background: #eee;
        }
        .panel-search .panel-body {
            margin-top: 13px;
        }
    </style>
    <style>
        .form-self{
            display: block;
            width: 100%;
            padding: 6px 12px;
            font-size: 14px;
            color: #555;
            background-color: #fff;
            background-image: none;
            border: 1px solid #ccc;
            border-radius: 4px;
            -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
            box-shadow: inset 0 1px 1px rgba(0,0,0,.075);
            -webkit-transition: border-color ease-in-out .15s,-webkit-box-shadow ease-in-out .15s;
            -o-transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
            transition: border-color ease-in-out .15s,box-shadow ease-in-out .15s;
        }
    </style>
</head>
<body>
{include file='public/header'/}
<!------------------导航-------------------------->
<section id="content">
    {include file='public/left'/}
    <!--------------------------主要内容区域------------------------------------->
    <div class="content" >
        <div class="page-heading mgl15 mgr15">
            <!--路径导航-->
            <ol class="breadcrumb">
                <li>当前位置是:</li>
                <li>
                    <a href="javascript:;">会员卡管理</a>
                </li>
                <li>
                    <a href="{:url('cardus/carduslist')}">会员卡列表</a>
                </li>
                <li>
                    <a href="{:url('cardus/cardinfo',['card_id'=>$card['card_id']])}">控制面板</a>
                </li>
                <li class="active">会员</li>
            </ol>

        </div>


        <div class="panel panel-default mgl15 mgr15">
            <div class="panel-heading">
                <h5 class="panel-title">
                    会员

                </h5>
            </div>
            <div class="panel-body">
                <ul class="fenxilist clearfix">
                    <li class="col-sm-3">
                        <div>领卡会员</div>
                        <div>{$carduser.count}人</div>
                    </li>
                    <li class="col-sm-3">
                        <div>激活会员</div>
                        <div>{$carduser.fire}人</div>
                    </li>
                    <li class="col-sm-3">
                        <div>未激活会员</div>
                        <div>{$carduser.notfire}人</div>
                    </li>
                    <li class="col-sm-3">
                        <div>删卡会员</div>
                        <div>{$carduser.nothave}人</div>
                    </li>
                </ul>
            </div>
        </div>

        <div class="panel panel-default panel-search mgl15 mgr15">
            <div class="panel-heading">
                <h5 class="panel-title"><span class="glyphicon glyphicon-search pull-left" style="margin-right: 10px;"></span>会员查找</h5>
            </div>
            <div class="panel-body">
                <form action="" method="get" class="form-horizontal table-search form-search" role="form" id="machform">
                    <div class="col-sm-6 col-md-6 col-lg-4 ">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">昵称：</label>
                            <div class="col-sm-9">
                                <input type="text"  autocomplete="off" disableautocomplete class="form-control"  placeholder="请输入" value="{$p_data['nickname']}" name="nickname">
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-6 col-md-6 col-lg-4 ">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">卡号：</label>
                            <div class="col-sm-9">
                                <input type="text" autocomplete="off" disableautocomplete class="form-control"  placeholder="请输入卡号" value="{$p_data['code']}" name="code">
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-6 col-md-6 col-lg-4 ">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">激活状态：</label>
                            <div class="col-sm-9">
                                <select name="fire" class="form-control">
                                    <option value="">请选择激活状态</option>
                                    <option value="1" {if condition="$p_data['fire'] eq '1'"}selected{/if}>已激活</option>
                                    <option value="0" {if condition="$p_data['fire'] eq '0'"}selected{/if}>未激活</option>
                                </select>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-6 col-md-6 col-lg-4 ">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">积分筛选：</label>
                            <div class="col-sm-9">
                                <select name="bonus_scr" class="form-control">
                                    <option value="">请选择排序</option>
                                    <option value="1" {if condition="$p_data['bonus_scr'] eq '1'"}selected{/if}>从高到低</option>
                                    <option value="2" {if condition="$p_data['bonus_scr'] eq '2'"}selected{/if}>从低到高</option>
                                </select>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-6 col-md-6 col-lg-4 ">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">余额筛选：</label>
                            <div class="col-sm-9">
                                <select name="balance_scr" class="form-control">
                                    <option value="">请选择排序</option>
                                    <option value="1" {if condition="$p_data['balance_scr'] eq '1'"}selected{/if}>从高到低</option>
                                    <option value="2" {if condition="$p_data['balance_scr'] eq '2'"}selected{/if}>从低到高</option>
                                </select>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-6 col-md-6 col-lg-4 ">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">领取时间筛选：</label>
                            <div class="col-sm-9">
                                <select name="get_scr" class="form-control">
                                    <option value="">请选择排序</option>
                                    <option value="1" {if condition="$p_data['get_scr'] eq '1'"}selected{/if}>从早到晚</option>
                                    <option value="2" {if condition="$p_data['get_scr'] eq '2'"}selected{/if}>从晚到早</option>
                                </select>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
            <div class="panel-footer">
                <a href="javascript:;" class="btn btn-primary" onclick="searchform()">查找</a>
                <a href="javascript:;" class="btn btn-default" onclick="clearform()">清空</a>
            </div>
        </div>
        <div class="alert alert-success" style="background-color: rgba(204, 228, 223, 0.3);margin: 5px 10px 5px 10px;">
            <strong>
                <i class="ti-info-alt"></i>
            </strong>
            会员卡管理（旧）中，统计显示只到2018-9-1日之前，之后的不再做统计，数据可能会和现用的数据统计及显示有所差异，2018-9-1日起的数据全部以现有的会员卡管理中为准。此会员管理不可再核销或充值积分及余额。
        </div>
        <div class="panel mgl15 mgr15" >

            <div class="panel-heading addCharts" style="background:#ededed;">
                会员列表
                <!--<a href="{:url('cardus/getlists',['card_id'=>$card['card_id'],'type'=>1])}" class="btn btn-success pull-right mgl15" style="margin-top: -6px;">当前会员</a>-->
            </div>
            <div class="panel-body">
                <table class="table table-bordered table-hover" data-toolbar="#toolbar">
                    <thead>
                    <tr>
                        <th style="padding: 10px;">头像</th>
                        <th>姓名/会员卡号</th>
                        <th>昵称/状态</th>
                        <th>手机号</th>
                        <th>余额</th>
                        <th>积分</th>
                        <th>使用频次</th>
                        <th>注册时间</th>
                        {if condition="checkPath('cardus/getcardupdate') || checkPath('report/cardusbalance')"}
                        <th>操作</th>
                        {/if}
                    </tr>
                    </thead>
                    <tbody>
                    {volist name="list" id="vo"}
                    <tr>
                        <td style="padding: 10px;">
                            {eq name=":get_user_headurl($vo['openid'])" value="0"}
                            <span class="img-circle thumb-sm laze-img" style="display: inline-block;"></span>
                            {else/}
                            <img src="{:get_user_headurl($vo['openid'])}" alt="" class="img-circle thumb-sm laze-img">
                            {/eq}

                        </td>
                        <td>{$vo.name}
                            {eq name="vo.sex" value="1"}
                            <img src="__STATIC_URL__/static/img/m.png" alt="" class="" style="width: 10px;margin-top: -3px;">
                            {/eq}
                            {eq name="vo.sex" value="0"}
                            <img src="__STATIC_URL__/static/img/f.png" alt="" class="" style="width: 10px;margin-top: -3px;">
                            {/eq}
                            <br> <code>{$vo.code}</code> </td>
                        <td >
                            <a class="btn-link" href="javascript:;" {lt name=":session('login_top_mid')" value="501"} onclick="show(this,'{$vo.id}');" {/lt} >
                            {eq name="vo.fire" value="1"}
                            {$vo.nickname}
                            {else/}
                            未获取
                            {/eq}
                            <br> <code>{:getfollowstatu($vo['openid'])}</code>
                            <code>
                                {switch name="vo.fire"}
                                {case value="1"}已激活{/case}
                                {case value="0"}未激活{/case}
                                {/switch}
                            </code>
                            </a>
                        </td>

                        <td>{$vo.phone}</td>
                        <td>{$vo.balance}</td>
                        <td>{$vo.bonus}</td>

                        <td>{:get_cardus_frequency($vo['openid'])}/次</td>
                        <td>{$vo.create_time}</td>
                        {if condition="checkPath('cardus/getcardupdate') || checkPath('report/cardusbalance')"}

                        <td class="chakan">

                            {if condition="checkPath('cardusold/cardusbalanceold')"}
                            <a class="btn-link" href="{:url('cardusold/cardusbalanceold',['get_id'=>$vo['id']])}">消费明细</a>
                            {/if}

                            <!--<a class="btn-link" href="{:url('cardus/edituserinfo',['id'=>$vo['id']])}">修改</a>-->

                        </td>
                        {/if}
                    </tr>
                    {/volist}
                    </tbody>
                </table>
                {$list->render()}
            </div>
        </div>
        {include file='public/footer'/}
    </div>
</section>
<!-- 充值Modal -->
<div class="modal fade" id="czModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="czModalLabel">会员卡充值</h4>
            </div>
            <div class="modal-body">
                <form class="form-horizontal" id="cz">
                    <div class="form-group">
                        <label class="col-sm-2 control-label">门店：</label>
                        <div class="col-sm-10">
                            <input type="hidden" name="id" id="czcard-id" >
                            <select name="mid" id="czhe-md" class="form-control" required="required">
                                <option value="">选择门店</option>
                                {volist  name="mach" id="md"}
                                <option value="{$md.id}">{$md.merchant}</option>
                                {/volist}
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">核销员：</label>
                        <div class="col-sm-10">
                            <input type="text" name="username" id="cznickname" readonly="readonly"  required="required" class="form-control" value="{$user.nickname}">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">充值类别：</label>
                        <div class="col-sm-10">
                            <select id="cz-kind" class="form-control" required="required" onchange="czkindfun(this.value)">
                                <option value="1">余额</option>
                                <option value="2">积分</option>
                            </select>
                        </div>
                    </div>
                    <div id="czshow">
                        <div class="form-group">
                            <label class="col-sm-2 control-label">充值面额：</label>
                            <div class="col-sm-10">
                                <select name="giveid" id="czme" class="form-control">
                                    <option value="">其他金额</option>
                                    {volist  name="czgive" id="me"}
                                    <option value="{$me.id}" data-money="{$me.zs_money}{if condition='$me.zs_money' neq ''}元{/if}" data-zsnew="{:getgivecardnew($me.zs_card_id_all,0)}" data-zs="{:getgivecard($me.zs_card_id,0)}">充值{$me.cz_money}元</option>
                                    {/volist}
                                </select>
                            </div>
                        </div>
                        <div class="form-group hidden" id="czsm-wrap">
                            <label class="col-sm-2 control-label">赠送：</label>
                            <div class="col-sm-10">
                                <div class="form-self" id="czsm"></div>
                            </div>
                        </div>
                    </div>
                    <div class="form-group" id="czje">
                        <label class="col-sm-2 control-label" id="czname">充值金额：</label>
                        <div class="col-sm-10">
                            <input type="hidden" name="type" id="czmodal-type">
                            <input type="text" name="add_balance" id="czadd_balance" oninput="if(isNaN(value))execCommand('undo')"  required="required" class="form-control" value="">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">充值说明：</label>
                        <div class="col-sm-10">
                            <textarea name="record_balance" id="czrecord_balance" rows="3" style="resize: none;" required="required" class="form-control">后台充值</textarea>
                            <div class="r-desc">请对本次余额操作进行说明</div>
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                <button type="button" class="btn btn-primary" id="czsure">确认</button>
            </div>
        </div>
    </div>
</div>

<!-- 核销Modal -->
<div class="modal fade" id="hexiaoModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                <h4 class="modal-title" id="hexiaoModalLabel">会员卡核销</h4>
            </div>
            <div class="modal-body">
                <form class="form-horizontal" id="hexiao">
                    <div class="form-group">
                        <label class="col-sm-2 control-label">门店：</label>
                        <div class="col-sm-10">
                            <input type="hidden" name="id" id="card-id" >
                            <select name="mid" id="he-md" class="form-control" required="required">
                                <option value="">选择门店</option>
                                {volist  name="mach" id="md"}
                                <option value="{$md.id}">{$md.merchant}</option>
                                {/volist}
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">核销类型：</label>
                        <div class="col-sm-10">
                            <select id="he-type" class="form-control" required="required" onchange="changetype(this.value)">
                                <option value="1">金额</option>
                                <option value="2">积分</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">核销员：</label>
                        <div class="col-sm-10">
                            <input type="text" name="username" id="nickname" readonly="readonly"  required="required" class="form-control" value="{$user.nickname}">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label" id="he-name">核销金额：</label>
                        <div class="col-sm-10">
                            <input type="hidden" name="type" id="modal-type">
                            <input type="text" name="add_balance" id="add_balance" oninput="if(isNaN(value))execCommand('undo')"  required="required" class="form-control" value="">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label">核销说明：</label>
                        <div class="col-sm-10">
                            <textarea name="record_balance" id="record_balance" rows="3" style="resize: none;" required="required" class="form-control">后台核销</textarea>
                            <div class="r-desc">请对本次余额操作进行说明</div>
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                <button type="button" class="btn btn-primary" id="hxsure">确认</button>
            </div>
        </div>
    </div>
</div>
<!-- 会员资料Modal -->
<div class="modal fade bs-example-modal-sm" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
    <div class="modal-dialog modal-sm" role="document" style="width: 798px;height: 320px;">
        <div class="modal-content" style="height: 100%;">
            <div class="modal-body">
                <div id="info_nickname">
                    <span style="font-size: 22px;" id="nick-name"></span>
                </div>
                <!-- Tab panes -->
                <div class="tab-content">
                    <div role="tabpanel" class="tab-pane active" id="home">
                        <div class="r-title" style="line-height: 42px;font-size: 18px;font-weight: 700;border-bottom: 1px solid #ddd;margin-top: 12px;margin-bottom: 12px;">
                            会员资料
                        </div>
                        <div class="row info-row" id="templateHtml">
                            <script id="modallist" type="text/html">
                                <div class="col-xs-6">
                                    <label class="col-xs-4 text-right ng-binding">昵称：</label>
                                    <div class="col-xs-8 ng-binding">{{list.nickname}}</div>
                                </div>
                                <div class="col-xs-6">
                                    <label class="col-xs-4 text-right">会员卡号：</label>
                                    <div class="col-xs-8">{{list.code}}</div>
                                </div>
                                <div class="col-xs-6">
                                    <label class="col-xs-4 text-right ng-binding">积分：</label>
                                    <div class="col-xs-8 ng-binding">{{list.bonus}}</div>
                                </div>
                                <div class="col-xs-6">
                                    <label class="col-xs-4 text-right ng-binding">余额：</label>
                                    <div class="col-xs-8">{{list.balance}}</div>
                                </div>
                                {eq name=":getfirefield($card['card_id'],'USER_FORM_INFO_FLAG_MOBILE')" value="1"}
                                <div class="col-xs-6">
                                    <label class="col-xs-4 text-right ng-binding">手机号：</label>
                                    <div class="col-xs-8">{{list.phone}}</div>
                                </div>
                                {/eq}
                                {eq name=":getfirefield($card['card_id'],'USER_FORM_INFO_FLAG_SEX')" value="1"}
                                <div class="col-xs-6">
                                    <label class="col-xs-4 text-right ng-binding">性别：</label>
                                    {{ if list.sex == '1'}}
                                    <div class="col-xs-8">男</div>
                                    {{/if}}
                                    {{ if list.sex == '0' }}
                                    <div class="col-xs-8">女</div>
                                    {{/if}}
                                </div>
                                {/eq}
                                {eq name=":getfirefield($card['card_id'],'USER_FORM_INFO_FLAG_NAME')" value="1"}
                                <div class="col-xs-6">
                                    <label class="col-xs-4 text-right ng-binding">姓名：</label>
                                    <div class="col-xs-8">{{list.name}}</div>
                                </div>
                                {/eq}
                                {eq name=":getfirefield($card['card_id'],'USER_FORM_INFO_FLAG_LOCATION')" value="1"}
                                <div class="col-xs-6 ng-scope">
                                    <label class="col-xs-4 text-right ng-binding">地址：</label>
                                    <div class="col-xs-8">{{list.address}}</div>
                                </div>
                                {/eq}
                                {eq name=":getfirefield($card['card_id'],'USER_FORM_INFO_FLAG_BIRTHDAY')" value="1"}
                                <div class="col-xs-6">
                                    <label class="col-xs-4 text-right ng-binding">生日：</label>
                                    <div class="col-xs-8">{{list.birthday}}</div>
                                </div>
                                {/eq}
                                {eq name=":getfirefield($card['card_id'],'USER_FORM_INFO_FLAG_IDCARD')" value="1"}
                                <div class="col-xs-6">
                                    <label class="col-xs-4 text-right ng-binding">身份证：</label>
                                    <div class="col-xs-8">{{list.idnumber}}</div>
                                </div>
                                {/eq}
                                {eq name=":getfirefield($card['card_id'],'USER_FORM_INFO_FLAG_EMAIL')" value="1"}
                                <div class="col-xs-6">
                                    <label class="col-xs-4 text-right ng-binding">邮箱：</label>
                                    <div class="col-xs-8">{{list.email}}</div>
                                </div>
                                {/eq}
                                {eq name=":getfirefield($card['card_id'],'USER_FORM_INFO_FLAG_INDUSTRY')" value="1"}
                                <div class="col-xs-6">
                                    <label class="col-xs-4 text-right ng-binding">行业：</label>
                                    <div class="col-xs-8">{{list.industry}}</div>
                                </div>
                                {/eq}
                                {eq name=":getfirefield($card['card_id'],'USER_FORM_INFO_FLAG_INCOME')" value="1"}
                                <div class="col-xs-6">
                                    <label class="col-xs-4 text-right ng-binding">收入：</label>
                                    <div class="col-xs-8">{{list.income}}</div>
                                </div>
                                {/eq}
                                {eq name=":getfirefield($card['card_id'],'USER_FORM_INFO_FLAG_HABIT')" value="1"}
                                <div class="col-xs-6">
                                    <label class="col-xs-4 text-right ng-binding">兴趣爱好：</label>
                                    <div class="col-xs-8">{{list.habit}}</div>
                                </div>
                                {/eq}
                                {eq name=":getfirefield($card['card_id'],'USER_FORM_INFO_FLAG_EDUCATION_BACKGRO')" value="1"}
                                <div class="col-xs-6">
                                    <label class="col-xs-4 text-right ng-binding">教育背景：</label>
                                    <div class="col-xs-8">{{list.backgro}}</div>
                                </div>
                                {/eq}
                                {eq name=":getfirefield($card['card_id'],'实体卡号')" value="1"}
                                <div class="col-xs-6">
                                    <label class="col-xs-4 text-right ng-binding">实体卡号：</label>
                                    <div class="col-xs-8">{{list.old_code}}</div>
                                </div>
                                {/eq}
                            </script>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<!--会员卡详情-->
<div class="side-bar right-bar">
    <i class="ti-close side_close_btn">
    </i>

    <div class="user_info">
        <div class="contact-card">
            <a class="pull-left" href="#">
                <img class="img-circle" alt id="head_imgUrl" src="">
            </a>
            <div class="member-info">
                <h4 class="m-t-0 m-b-5 ">
                    <b id="head_memberName">会员姓名：</b>
                    <input type="hidden" id="cid" data-id="">
                    <input type="hidden" id="openid" data-id="">
                    <input type="hidden" id="code" data-id="">
                    <input type="hidden" id="top_mid" data-id="">
                    <span id="member_grade_name" class="margin-0-10"> 普通会员</span>
                </h4>
                <p class="text-muted">
                    <span id="head_memberMobile">手机号码：</span>
                </p>
                <p class="text-dark">
                    <small id="head_nickName">会员昵称：
                    </small>
                </p>
            </div>
        </div>
        <div class="btn-group text-btn right show_operator_btn" role="group">
            <!--<button class="btn btn-link waves-effect" style="height:100%;" id="member_detail_edit" onclick="editMember()">-->
                <!--<i class="glyphicon glyphicon-pencil">-->
                <!--</i>-->
                <!---->
                <!--编辑-->
            <!--</button>-->
        </div>
    </div>
    <div class="side-page-content">
        <div class="col-lg-12" style=" padding: 0px; ">
            <ul class="nav nav-tabs tabs" data-w="800" tab-w="100" style="width: 100%;" id="myTab">
                <li class="tab active">
                    <a href="#member-info" data-toggle="tab"  id="member-info-id" >会员信息</a>
                </li>
                <li class="tab">
                    <a href="#member-assets" data-toggle="tab" onclick="getcarduserxfinfo();">消费信息</a>
                </li>
                <li class="tab">
                    <a href="#member-consume" data-toggle="tab" onclick="getcarduserxflist();">
                        <span class="hidden-xs">消费记录</span>
                    </a>
                </li>
                <!--<li class="tab">-->
                <!--<a href="#member-refunds" data-toggle="tab">-->
                <!--<span class="hidden-xs">退款记录</span>-->
                <!--</a>-->
                <!--</li>-->
                <li class="tab">
                    <a href="#member-recharge" data-toggle="tab" onclick="getcarduserczlist();">
                        <span class="hidden-xs">充值记录</span>
                    </a>
                </li>
                <li class="tab">
                    <a href="#member-point" data-toggle="tab" onclick="getcarduserbonuslist();">
                        <span class="hidden-xs">积分记录</span>
                    </a>
                </li>
                <li class="tab">
                    <a href="#member-coupon" data-toggle="tab" onclick="getcardusercardslist();">
                        <span class="hidden-xs">优惠券</span>
                    </a>
                </li>

                <li class="tab">
                    <a href="#member-redenvelope" data-toggle="tab" onclick="getremarklist();">
                        <span class="hidden-xs">备注记录</span>
                    </a>
                </li>
            </ul>
            <div class="tab-content" style=" padding: 0px; margin-bottom: 0px; ">
                <div class="tab-pane fade in active" id="member-info">
                    <div id="locus_tit" class="locus_tit">
                        <p class="first">
                        <span>
                            <strong>会员资产</strong>
                        </span>
                        </p>
                        <p>
                            <span>
                                <i class="glyphicon glyphicon-credit-card">
                                </i> 总余额：
                                <em id="member_zbalance">-</em>元
                            </span>
                            <span>
                                <i class="glyphicon glyphicon-credit-card">
                                </i>  实充余额：
                                <em id="member_charge">-</em>元
                            </span>
                            <span>
                                <i class="md md-credit-card">
                                </i>   赠送余额：
                                <em id="member_give">-</em>元
                            </span>
                            <span>
                                <i class="glyphicon glyphicon-fire">
                                </i>  经验值：
                                <em id="member_experience">0</em>
                            </span>
                            <span>
                                <i class="glyphicon glyphicon-star-empty">
                                </i>  积分：
                                <em id="member_integral">-</em>分
                            </span>
                            <!--<span>-->
                            <!--<i class="glyphicon glyphicon-gift">-->
                            <!--</i>  红包：-->
                            <!--<em id="member_envelopes">0</em>元-->
                            <!--</span>-->
                            <span>
                                <i class="glyphicon glyphicon-bookmark">
                                </i>  优惠券：
                                <em id="member_Coupon">-</em>张
                            </span>


                        </p>
                    </div>
                    <div id="locus_tit" class="locus_tit">
                        <p class="first">
                        <span>
                            <strong>基础信息</strong>
                        </span>
                        </p>
                        <p>
                            <span>
                               会员卡号：
                                <em id="member_number">--</em>
                            </span>
                            <span>
                                  手机号码：
                                <em id="member_phone">--</em>
                            </span>
                            <span>
                                  所属门店：
                                <em id="member_shop">--</em>
                            </span>
                            <span>
                                会员等级：
                                <em id="member_grade">--</em>
                            </span>
                            <!--<span>-->
                            <!--领卡方式：-->
                            <!--<em id="collar_card">&#45;&#45;</em>-->
                            <!--</span>-->
                            <span>
                                 推荐人：
                                <em id="Recommend">--</em>
                            </span>
                            <span>
                                 会员性别：
                                <em id="member_sex">--</em>
                            </span>
                            <span>
                                会员生日：
                                <em id="member_birth">--</em>
                            </span>
                            <span>
                                 会员年龄：
                                <em id="member_no">--</em>
                            </span>
                            <span>
                                 会员星座：
                                <em id="member_constellation">--</em>
                            </span>
                            <span>
                                 注册日期：
                                <em id="member_register">--</em>
                            </span>
                            <span>
                                 公众号关注：
                                <em id="member_follow">--</em>
                            </span>
                            <span>
                                会员绑定：
                                <em id="binding">微信</em>
                            </span>


                            <span>
                                 会员邮箱：
                                <em id="member_email">--</em>
                            </span>
                            <span>
                                所在地址：
                                <em id="member_address">--</em>
                            </span>
                            <!--<span>-->
                            <!--所在省份：-->
                            <!--<em id="member_sf">中国</em>-->
                            <!--</span>-->
                            <!--<span>-->
                            <!--所在城市：-->
                            <!--<em id="member_cs">中国</em>-->
                            <!--</span>-->


                        </p>
                    </div>
                    <div id="locus_tit" class="locus_tit">
                        <p class="first">
                        <span>
                            <strong>扩展信息</strong>
                        </span>
                        </p>
                        <p>
                            <span>
                                备注：
                                <em id="member_expt">--</em>
                            </span>



                        </p>
                    </div>
                    <div class="locus_tit">
                        <p class="first">
                        <span>
                            <strong>其他信息</strong>
                        </span>
                        </p>
                        <p>
                            <span>
                                 最近使用设备：
                                <em id="member_equipment">--</em>
                            </span>
                            <span>
                                 最近使用ip：：
                                <em id="member_ip">--</em>
                            </span>
                            <span>
                              最近定位地址：
                                <em id="member_Location">--</em>
                            </span>
                            <span>
                               最近使用网络：
                                <em id="member_network">--</em>
                            </span>

                        </p>
                    </div>
                </div>
                <div class="tab-pane fade" id="member-assets">
                    <div id="locus_tit" class="locus_tit">
                        <p class="first">
                        <span>
                            <strong>消费统计</strong>
                        </span>
                        </p>
                        <p>
                            <span>
                                 累计消费金额：
                                <em id="del_balance">--</em>元
                            </span>
                            <span>
                                累计充值金额：
                                <em id="xfadd_balance">--</em>元
                            </span>
                            <span>
                             累计获得积分：
                                <em id="add_bonus">--</em>
                            </span>
                            <span>
                              累计消费笔数：
                                <em id="xf_nume">--</em>笔
                            </span>
                            <span>
                              累计充值次数 ：
                                <em id="cz_nume">--</em>次
                            </span>
                            <span>
                               累计使用积分：
                                <em id="del_bonus">--</em>
                            </span>
                            <span>
                             累计获得优惠券：
                                <em id="get_cards">--</em>个
                            </span>
                            <span>
                             累计退款次数：
                                <em id="member_network">--</em>次
                            </span>

                        </p>
                    </div>
                    <div id="locus_tit" class="locus_tit">
                        <p class="first">
                        <span>
                            <strong>最近消费</strong>
                        </span>
                        </p>
                        <p>
                            <span>
                                 最近消费门店：
                                <em id="member_merchant">--</em>
                            </span>
                            <span>
                                最近消费金额：
                                <em id="member_pay_balance">--</em>元
                            </span>
                            <span>
                             最近购买商品数量 ：
                                <em id="member_Location">--</em>
                            </span>
                            <span>
                              最近消费时间：
                                <em id="member_pay_time">--</em>
                            </span>


                        </p>
                    </div>
                    <div id="locus_tit" class="locus_tit">
                        <p class="first">
                        <span>
                            <strong>平均消费</strong>
                        </span>
                        </p>
                        <p>
                            <span>
                                 平均客消费：
                                <em id="pjdel_balance">--</em>元
                            </span>
                            <span>
                                平均客充值：
                                <em id="pjadd_balance">--</em>元
                            </span>
                            <span>
                            平均件单价：
                                <em id="member_Location">--</em>元
                            </span>
                            <span>
                              平均消费折扣 ：
                                <em id="discount">--</em>元
                            </span>


                        </p>
                    </div>
                </div>
                <div class="tab-pane fade" id="member-consume">
                    <div style=" margin-top: 15px; ">


                        <table class="table table table-hover m-0">
                            <thead>
                            <tr>
                                <th>消费时间</th>
                                <th>消费门店</th>
                                <th>订单金额</th>
                                <th>支付金额</th>
                                <th>优惠金额</th>
                                <th>消费类型</th>

                            </tr>
                            </thead>
                            <tbody id="xfjl">

                            </tbody>
                        </table>
                        <div id="pagecount" class="pagecount"></div>
                    </div>
                </div>
                <div class="tab-pane fade" id="member-refunds">
                    <div style=" margin-top: 15px; ">

                        <table class="table table table-hover m-0">
                            <thead>
                            <tr>
                                <th>订单号/退款时间</th>
                                <th>退款门店</th>
                                <th>退款金额</th>
                                <th>退款类型</th>

                            </tr>
                            </thead>
                            <tbody id="tkjl">

                            </tbody>
                        </table>
                        <div id="pagecounts1" class="pagecount"></div>
                    </div>
                </div>
                <div class="tab-pane fade" id="member-recharge">
                    <div style=" margin-top: 15px; ">

                        <table class="table table table-hover m-0">
                            <thead>
                            <tr>
                                <th>充值时间</th>
                                <th>充值门店</th>
                                <th>充值金额</th>
                                <th>赠送金额</th>
                                <th>到账金额</th>

                                <th>充值方式</th>
                            </tr>
                            </thead>
                            <tbody id="cczje">

                            </tbody>
                        </table>
                        <div id="pagecounts" class="pagecount"></div>
                    </div>
                </div>
                <div class="tab-pane fade" id="member-point">
                    <div style=" margin-top: 15px; ">

                        <table class="table table table-hover m-0">
                            <thead>
                            <tr>
                                <th>变动时间</th>
                                <th>变动积分</th>
                                <th>变动类型</th>
                            </tr>
                            </thead>
                            <tbody id="jfjl">

                            </tbody>
                        </table>
                        <div id="pagecount2" class="pagecount"></div>
                    </div>
                </div>
                <div class="tab-pane fade" id="member-coupon">
                    <div style=" margin-top: 15px; ">

                        <table class="table table table-hover m-0">
                            <thead>
                            <tr>
                                <th>领取时间</th>
                                <th>优惠券类型</th>
                                <th>门店名称</th>
                                <th>卡券状态</th>
                                <th>优惠券名称</th>


                            </tr>
                            </thead>
                            <tbody id="yhqlq">

                            </tbody>
                        </table>
                        <div id="pagecount3" class="pagecount"></div>
                    </div>
                </div>

                <div class="tab-pane fade" id="member-redenvelope">
                    <div style=" margin-top: 15px; ">

                        <table class="table table table-hover m-0">
                            <thead>
                            <tr>
                                <th>备注时间</th>
                                <th>备注人</th>
                                <th>备注详情</th>


                            </tr>
                            </thead>
                            <tbody id="bzjl">

                            </tbody>
                        </table>
                        <div id="pagecount4" class="pagecount"></div>
                    </div>
                </div>



            </div>

        </div>
    </div>
</div>
<!-- 修改个人资料模态框（Modal） -->
<div class="modal fade" id="myModal3" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal"
                        aria-hidden="true">×
                </button>
                <h4 class="modal-title" id="myModalLabel">
                    编辑会员信息
                </h4>
            </div>
            <div class="modal-body">
                <form name="editMemberForm" id="editMemberForm" method="post">
                    <div class="form-group">
                        <input type="hidden" class="form-control edit-ipt" id="openid1" name="openid" value="" >
                        <input type="hidden" class="form-control edit-ipt" id="code1" name="code" value="" >
                        <label for="recipient-name" class="control-label">会员姓名：</label>
                        <input type="text" class="form-control edit-ipt" id="e_memberName" name="name" value="" placeholder="会员姓名">
                        <label for="message-text" class="control-label edit-lf">会员昵称：</label>
                        <input type="text" class="form-control edit-ipt" id="e_nickName" name="nickname" value="" placeholder="会员昵称">
                    </div>
                    <div class="form-group">
                        <label for="message-text" class="control-label">会员手机：</label>
                        <input type="text" class="form-control edit-ipt" id="e_mobile" maxlength="11" name="phone" value="" placeholder="手机号码" onkeyup="this.value=this.value.replace(/\D/gi,"")">
                        <label for="message-text" class="control-label edit-lf">会员邮箱：</label>
                        <input class="form-control edit-ipt" id="e_email" type="text" name="email" value placeholder="会员邮箱">
                    </div>
                    <div class="form-group">
                        <label for="message-text" class="control-label">会员性别：</label>
                        <select  class="form-control select2 edit-ipt select2-hidden-accessible" name="sex" id="m_sex" tabindex="-1" aria-hidden="true">
                            <option value="2">未知</option>
                            <option value="1">男</option>
                            <option value="0" >女</option>
                        </select>
                        <label for="message-text" class="control-label edit-lf">会员生日：</label>

                        <input type="text" class="form-control com-interval com-time edit-ipt" id='e_birthday' readonly name='birthday'  placeholder="会员生日" value="">

                        <!--<label for="message-text" class="control-label edit-lf">会员等级：</label>-->
                        <!--<input class="form-control edit-ipt" id="levelId" readonly="readonly" type="text" name="level" value placeholder="会员等级">-->


                    </div>
                    <div class="form-group">
                        <label for="beizhu" class="control-label">备注：</label>
                        <input type="text" class="form-control" id="beizhu" name="remark" value="" placeholder="请输入备注">

                    </div>

                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default"
                        data-dismiss="modal">关闭
                </button>
                <button type="button" class="btn btn-primary" id="btn-primary">
                    提交更改
                </button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<div class="sidenav-overlay absolute"></div>
<script src="__STATIC_URL__/static/js/template.js"></script>
<script src="__STATIC_URL__/static/layer/layer.js"></script>
<script>
    function getcarduserxfinfo(){
        var openid=$("#openid").attr("data-id");
        var code=$("#code").attr("data-id");
        var top_mid=$("#top_mid").attr("data-id");
        $.ajax({
            url:"{:url('cardusold/getcarduserxfinfoold')}",
            type:"post",
            data:{
                openid:openid,
                code:code,
                top_mid:top_mid

            },
            success:function(data){
                //console.log(data);
                data.average.del_balance = data.average.del_balance.toFixed(2);
                data.average.discount = data.average.discount.toFixed(2);
                data.average.add_balance = data.average.add_balance.toFixed(2);
                $("#del_balance").html(data.xfcount.del_balance);
                $("#xfadd_balance").html(data.xfcount.add_balance);
                $("#add_bonus").html(data.xfcount.add_bonus);
                $("#xf_nume").html(data.xfcount.xf_nume);
                $("#cz_nume").html(data.xfcount.cz_nume);
                $("#del_bonus").html(data.xfcount.del_bonus);
                $("#get_cards").html(data.xfcount.get_cards);
                $("#member_merchant").html(data.lately.merchant);
                $("#member_pay_balance").html(data.lately.pay_balance);
                $("#member_pay_time").html(data.lately.pay_time);
                $("#pjdel_balance").html(data.average.del_balance);
                $("#pjadd_balance").html(data.average.add_balance);
                $("#discount").html(data.average.discount);

            }
        })

    }
</script>
<script>
    /*消费记录*/
    function getcarduserxflist(){
        var p=1;
        var page=1;
        var openid=$("#openid").attr("data-id");
        var code=$("#code").attr("data-id");
        var tr="";

        $("#xfjl").attr("data-text",p);
        var curPage = 1; //当前页码
        var total,pageSize,totalPage; //总记录数，每页显示数，总页数
        getData(1);
        $("#pagecount").on('click','span a',function(){
            var rel = $(this).attr("rel");
            if(rel){
                getData(rel);
            }
        });
        function getData(page) {
            $.ajax({
                url:"{:url('cardusold/getcarduserxflistold')}",
                type:"post",
                data:{
                    openid:openid,
                    code:code,
                    page:page
                },
                success: function (data) {
                    //console.log(11,data);
                    var text = data.data;
                    //console.log(text);
                    total = parseInt(data.conut); //总记录数
                    pageSize = 10; //每页显示条数
                    curPage = page; //当前页
                    totalPage = parseInt(data.pagenum); //总页数
                    $('#xfjl').html("");
                    //console.log();
                    tr="";
                    if(data.code=='9001'){
                        total=0;
                        totalPage=0;
                    }
                    for (var i = 0; i < text.length; i++) {
                        //console.log(text[i].code);
                        var balance=text[i].pay_balance-text[i].del_balance;
                        balance = balance.toFixed(2);
                        tr += '<tr><td><code>' + text[i].create_time + '</code></td><td>' + text[i].merchant + ' </td><td>' + text[i].pay_balance + '</td><td>' + text[i].del_balance+ ' </td><td>' + balance + '</td><td>会员卡支付 </td></tr>'

                    }

                    $('#xfjl').append(tr);
                },
                complete:function(){ //生成分页条
                    getPageBar();
                },
                error:function(){
                    alert("数据加载失败");
                }
            });
        }
        function getPageBar(){
            $("#pagecount").find('*').remove();
            //页码大于最大页数
            if(curPage>totalPage) curPage=totalPage;
            //页码小于1
            if(curPage<1) curPage=1;
            pageStr = "<span>共"+total+"条</span><span>"+curPage+"/"+totalPage+"</span>";

            //如果是第一页
            if(curPage==1){
                pageStr += "<span>首页</span><span>上一页</span>";
            }else{
                pageStr += "<span><a href='javascript:void(0)' rel='1'>首页</a></span><span><a href='javascript:void(0)' rel='"+(curPage-1)+"'>上一页</a></span>";
            }

            //如果是最后页
            if(curPage>=totalPage){
                pageStr += "<span>下一页</span><span>尾页</span>";
            }else{
                pageStr += "<span><a href='javascript:void(0)' rel='"+(parseInt(curPage)+1)+"'>下一页</a></span><span><a href='javascript:void(0)' rel='"+totalPage+"'>尾页</a></span>";
            }
            $("#pagecount").append(pageStr);
        }


    }


</script>
<script>
    /*充值记录*/
    function getcarduserczlist(){
        var p=1;
        var page=1;
        var tr="";
        var openid=$("#openid").attr("data-id");

        var code=$("#code").attr("data-id");
        $("#cczje").attr("data-text",p);
        var curPage = 1; //当前页码
        var total,pageSize,totalPage; //总记录数，每页显示数，总页数
        getData(1);
        $("#pagecounts").on('click','span a',function(){
            var rel = $(this).attr("rel");
            if(rel){
                getData(rel);
            }
        });
        var top_mid=$("#top_mid").attr("data-id");
        function getData(page) {
            $.ajax({
                url:"{:url('cardusold/getcarduserczlistold')}",
                type:"post",
                data:{
                    openid:openid,
                    code:code,
                    page:page
                },
                success: function (data) {
                    // console.log(11,data);
                    var text = data.data;
                    //console.log(text);
                    total = parseInt(data.conut); //总记录数
                    pageSize = 10; //每页显示条数
                    curPage = page; //当前页
                    totalPage = parseInt(data.pagenum); //总页数
                    $('#cczje').html("");
                    //console.log();
                    tr="";
                    if(data.code=='9001'){
                        total=0;
                        totalPage=0;
                    }
                    for (var i = 0; i < text.length; i++) {
                        var balance=text[i].add_balance-text[i].pay_balance;

                        tr += '<tr><td><code>' + text[i].create_time + '</code></td><td>' + text[i].merchant + ' </td><td>' +  text[i].pay_balance  + '</td><td>' + balance+ ' </td><td>' + text[i].add_balance + '</td><td>' + text[i].pay_fs + ' </td></tr>'

                    }

                    $('#cczje').append(tr);
                },
                complete:function(){ //生成分页条
                    getPageBar();
                },
                error:function(){
                    alert("数据加载失败");
                }
            });
        }
        function getPageBar(){
            $("#pagecounts").find('*').remove();
            //页码大于最大页数
            if(curPage>totalPage) curPage=totalPage;
            //页码小于1
            if(curPage<1) curPage=1;
            pageStr = "<span>共"+total+"条</span><span>"+curPage+"/"+totalPage+"</span>";

            //如果是第一页
            if(curPage==1){
                pageStr += "<span>首页</span><span>上一页</span>";
            }else{
                pageStr += "<span><a href='javascript:void(0)' rel='1'>首页</a></span><span><a href='javascript:void(0)' rel='"+(curPage-1)+"'>上一页</a></span>";
            }

            //如果是最后页
            if(curPage>=totalPage){
                pageStr += "<span>下一页</span><span>尾页</span>";
            }else{
                pageStr += "<span><a href='javascript:void(0)' rel='"+(parseInt(curPage)+1)+"'>下一页</a></span><span><a href='javascript:void(0)' rel='"+totalPage+"'>尾页</a></span>";
            }
            $("#pagecounts").append(pageStr);
        }


    }


</script>
<script>
    /*积分*/
    function getcarduserbonuslist(){
        var p=1;
        var page=1;
        var openid=$("#openid").attr("data-id");
        var code=$("#code").attr("data-id");
        var top_mid=$("#top_mid").attr("data-id");
        var tr="";

        $("#jfjl").attr("data-text",p);
        var curPage = 1; //当前页码
        var total,pageSize,totalPage; //总记录数，每页显示数，总页数
        getData(1);
        $("#pagecount2").on('click','span a',function(){
            var rel = $(this).attr("rel");
            if(rel){
                getData(rel);
            }
        });
        function getData(page) {
            $.ajax({
                url:"{:url('cardusold/getcarduserbonuslistold')}",
                type:"post",
                data:{
                    openid:openid,
                    code:code,
                    page:page
                },
                success: function (data) {
                    console.log(11,data);
                    var text = data.data;
                    //console.log(text);
                    total = parseInt(data.conut); //总记录数
                    pageSize = 10; //每页显示条数
                    curPage = page; //当前页
                    totalPage = parseInt(data.pagenum); //总页数
                    $('#jfjl').html("");
                    //console.log();
                    tr="";
                    if(data.code=='9001'){
                        total=0;
                        totalPage=0;
                    }
                    for (var i = 0; i < text.length; i++) {
                        // console.log(text[i].code);
                        if(text[i].reason==19||text[i].reason==11){
                            var f= "-"
                            var bonus=  text[i].del_bonus
                        }else{
                            var f= "+"
                            var bonus= text[i].add_bonus
                        }

                        if(text[i].record_bonus==null){

                            text[i].record_bonus="";
                            //console.log(text[i].record_bonus);
                        }
                        tr += '<tr><td><code>' + text[i].create_time + '</code></td><td>' +f+bonus + ' </td><td>' + text[i].record_bonus+ ' </td></tr>'

                    }

                    $('#jfjl').append(tr);
                },
                complete:function(){ //生成分页条
                    getPageBar();
                },
                error:function(){
                    alert("数据加载失败");
                }
            });
        }
        function getPageBar(){
            $("#pagecount2").find('*').remove();
            //页码大于最大页数
            if(curPage>totalPage) curPage=totalPage;
            //页码小于1
            if(curPage<1) curPage=1;
            pageStr = "<span>共"+total+"条</span><span>"+curPage+"/"+totalPage+"</span>";

            //如果是第一页
            if(curPage==1){
                pageStr += "<span>首页</span><span>上一页</span>";
            }else{
                pageStr += "<span><a href='javascript:void(0)' rel='1'>首页</a></span><span><a href='javascript:void(0)' rel='"+(curPage-1)+"'>上一页</a></span>";
            }

            //如果是最后页
            if(curPage>=totalPage){
                pageStr += "<span>下一页</span><span>尾页</span>";
            }else{
                pageStr += "<span><a href='javascript:void(0)' rel='"+(parseInt(curPage)+1)+"'>下一页</a></span><span><a href='javascript:void(0)' rel='"+totalPage+"'>尾页</a></span>";
            }
            $("#pagecount2").append(pageStr);
        }


    }

</script>
<script>
    /********优惠券********/
    function getcardusercardslist(){
        var p=1;
        var page=1;
        var openid=$("#openid").attr("data-id");
        var code=$("#code").attr("data-id");
        var top_mid=$("#top_mid").attr("data-id");
        var tr="";

        $("#yhqlq").attr("data-text",p);
        var curPage = 1; //当前页码
        var total,pageSize,totalPage; //总记录数，每页显示数，总页数
        getData(1);
        $("#pagecount3").on('click','span a',function(){
            var rel = $(this).attr("rel");
            if(rel){
                getData(rel);
            }
        });
        function getData(page) {
            $.ajax({
                url:"{:url('cardusold/getcardusercardslistold')}",
                type:"post",
                data:{
                    openid:openid,
                    code:code,
                    top_mid:top_mid,
                    page:page
                },
                success: function (data) {
                    console.log(966,data);
                    var text = data.data;
                    // console.log(text);
                    total = parseInt(data.conut); //总记录数
                    pageSize = 10; //每页显示条数
                    curPage = page; //当前页
                    totalPage = parseInt(data.pagenum); //总页数
                    $('#yhqlq').html("");
                    //console.log();
                    tr="";
                    if(data.code=='9001'){
                        total=0;
                        totalPage=0;
                    }
                    for (var i = 0; i < text.length; i++) {
                        //console.log(text[i].code);
                        if(text[i].title==null){

                            text[i].title="";
                            //console.log(text[i].record_bonus);
                        }
                        tr += '<tr><td><code>' + text[i].create_time + '</code></td><td>' + text[i].card_type + ' </td><td>' + text[i].merchant+ ' </td><td>' + text[i].card_statu+ ' </td><td>' + text[i].title+ ' </td></tr>'

                    }

                    $('#yhqlq').append(tr);
                },
                complete:function(){ //生成分页条
                    getPageBar();
                },
                error:function(){
                    alert("数据加载失败");
                }
            });
        }
        function getPageBar(){
            $("#pagecount3").find('*').remove();
            //页码大于最大页数
            if(curPage>totalPage) curPage=totalPage;
            //页码小于1
            if(curPage<1) curPage=1;
            pageStr = "<span>共"+total+"条</span><span>"+curPage+"/"+totalPage+"</span>";

            //如果是第一页
            if(curPage==1){
                pageStr += "<span>首页</span><span>上一页</span>";
            }else{
                pageStr += "<span><a href='javascript:void(0)' rel='1'>首页</a></span><span><a href='javascript:void(0)' rel='"+(curPage-1)+"'>上一页</a></span>";
            }

            //如果是最后页
            if(curPage>=totalPage){
                pageStr += "<span>下一页</span><span>尾页</span>";
            }else{
                pageStr += "<span><a href='javascript:void(0)' rel='"+(parseInt(curPage)+1)+"'>下一页</a></span><span><a href='javascript:void(0)' rel='"+totalPage+"'>尾页</a></span>";
            }
            $("#pagecount3").append(pageStr);
        }


    }


</script>
<script>
    /********备注********/
    function getremarklist(){
        var p=1;
        var page=1;
        var openid=$("#openid").attr("data-id");
        var code=$("#code").attr("data-id");
        var top_mid=$("#top_mid").attr("data-id");
        var tr="";

        $("#bzjl").attr("data-text",p);
        var curPage = 1; //当前页码
        var total,pageSize,totalPage; //总记录数，每页显示数，总页数
        getData(1);
        $("#pagecount4").on('click','span a',function(){
            var rel = $(this).attr("rel");
            if(rel){
                getData(rel);
            }
        });
        function getData(page) {
            $.ajax({
                url:"{:url('cardusold/getremarklistold')}",
                type:"post",
                data:{
                    openid:openid,
                    code:code,
                    top_mid:top_mid,
                    page:page
                },
                success: function (data) {
                    console.log(33,data);
                    var text = data.data;
                    // console.log(text);
                    total = parseInt(data.conut); //总记录数
                    pageSize = 10; //每页显示条数
                    curPage = page; //当前页
                    totalPage = parseInt(data.pagenum); //总页数
                    $('#bzjl').html("");
                    //console.log();
                    tr="";
                    if(data.code=='9001'){
                        total=0;
                        totalPage=0;
                    }
                    for (var i = 0; i < text.length; i++) {
                        //console.log(text[i].code);
                              if(text[i].con_username==null){
                                var con_username="";
                              }else{
                                  con_username=text[i].con_username;
                              }
                        tr += '<tr><td><code>' + text[i].create_time + '</code></td><td>' + con_username+ ' </td><td>' + text[i].remark+ ' </td></tr>'

                    }

                    $('#bzjl').append(tr);
                },
                complete:function(){ //生成分页条
                    getPageBar();
                },
                error:function(){
                    alert("数据加载失败");
                }
            });
        }
        function getPageBar(){
            $("#pagecount4").find('*').remove();
            //页码大于最大页数
            if(curPage>totalPage) curPage=totalPage;
            //页码小于1
            if(curPage<1) curPage=1;
            pageStr = "<span>共"+total+"条</span><span>"+curPage+"/"+totalPage+"</span>";

            //如果是第一页
            if(curPage==1){
                pageStr += "<span>首页</span><span>上一页</span>";
            }else{
                pageStr += "<span><a href='javascript:void(0)' rel='1'>首页</a></span><span><a href='javascript:void(0)' rel='"+(curPage-1)+"'>上一页</a></span>";
            }

            //如果是最后页
            if(curPage>=totalPage){
                pageStr += "<span>下一页</span><span>尾页</span>";
            }else{
                pageStr += "<span><a href='javascript:void(0)' rel='"+(parseInt(curPage)+1)+"'>下一页</a></span><span><a href='javascript:void(0)' rel='"+totalPage+"'>尾页</a></span>";
            }
            $("#pagecount4").append(pageStr);
        }


    }


</script>
<script>
    /*编辑会员信息*/
    function editMember(){
        var id=$("#cid").attr("data-id");
        $.ajax({
            url:"{:url('cardusold/getcarduserinfoold')}",
            type:"post",
            data:{
                id:id
            },
            success:function(data){
                //console.log(77,data);
                $("#e_mobile").val(data.data.user.phone);
                $("#e_email").val(data.data.user.email);
                $("#e_nickName").val(data.data.user.nickname);
                $("#e_memberName").val(data.data.user.name);
                $("#e_birthday").val(data.data.user.birthday);

                $("#e_point").val(data.data.user.bonus);
                if(data.data.user.sex=='男'){

                    $("#m_sex").val('1');
                }
                if(data.data.user.sex=='女'){
                    //console.log(1123);
                    $("#m_sex").val('0');
                }
                $("#levelId").val(data.data.user.level);
                $("#merchantId").val(data.data.user.merchant);
                $("#code1").val(data.data.user.code);
                $("#openid1").val(data.data.user.openid);

                $(".right-bar").addClass("open");
                $(".sidenav-overlay").addClass("overlay-active");
            }
        })

        $('#myModal3').modal('show')
    }
    $("#btn-primary").click(function(){
        $.ajax({
            type: 'post',
            url: "{:url('cardusold/getcardusereditold')}",
            data: $("#editMemberForm").serialize(),
            success: function(data) {
                console.log(99,data);
                if(data.code=='0'){
                    alert(data.message);

                    $('#myModal3').modal('hide')
                    location.reload();
                }
                if(data.code=='9001'){
                    alert(data.message);
                }
                //console.log(data);
                // your code
            }
        });
    })
</script>

<script>
    /*查看会员信息*/
    function show(obj,id){
        $("#cid").attr("data-id",id);
        $("#head_imgUrl").attr("src","");
        $.ajax({
            url:"{:url('cardusold/getcarduserinfoold')}",
            type:"post",
            data:{
                id:id
            },
            success:function(data){
                console.log(data);
                $("#openid").attr("data-id",data.data.user.openid);
                $("#code").attr("data-id",data.data.user.code);
                $("#top_mid").attr("data-id",data.data.user.top_mid);
                if(data.data.wxinfo.head_url==""){
                    $("#head_imgUrl").attr("src","");
                }else{
                    $("#head_imgUrl").attr("src",data.data.wxinfo.head_url);
                }

                $("#Recommend").html(data.data.user.sharename);
                $("#head_memberMobile").html("手机号码："+data.data.user.phone);
                $("#head_nickName").html("会员昵称："+data.data.user.nickname);
                $("#head_memberName").html("会员姓名："+data.data.user.name);
                $("#member_integral").html(data.data.user.bonus);
                $("#member_zbalance").html(data.data.user.balance);
                $("#member_number").html(data.data.user.code);
                $("#member_phone").html(data.data.user.phone);
                $("#member_Coupon").html(data.data.cards);
                $("#member_shop").html(data.data.user.merchant);
                $("#member_email").html(data.data.user.email);
                $("#member_birth").html(data.data.user.birthday);
                if(data.data.user.zodiac=="null"){
                    data.data.user.zodiac="未获取";
                }
                $("#member_constellation").html(data.data.user.zodiac);
                $("#member_sex").html(data.data.user.sex);
                $("#member_grade").html(data.data.user.level);
                //console.log(11,data.data.user.age);
                if(data.data.user.age=="null"){
                    data.data.user.age="未获取";
                }
                $("#member_no").html(data.data.user.age);
                $("#member_address").html(data.data.user.address);
                $("#member_grade_name").html(data.data.user.level);
                $("#member_follow").html(data.data.user.is_follow);
                $("#member_register").html(data.data.user.create_time);




                $(".right-bar").addClass("open");
                $(".sidenav-overlay").addClass("overlay-active");
                $('#myTab a:first').tab('show')
            }
        })


    }
    $(".sidenav-overlay").click(function(){

        $(".right-bar").removeClass("open");
        $(".sidenav-overlay").removeClass("overlay-active");
        // location.reload();
    })
</script>
<script>
    var czhtml = $("#czshow").html();
    function czkindfun(value){
        if(value=='1'){
            $("#czname").text("充值金额：");
            $("#czje").removeClass("hidden");
            $("#czshow").html(czhtml);
            $("#czadd_balance").attr("name","add_balance");
        }else if(value="2"){
            $("#czadd_balance").attr("name","add_bonus");
            $("#czshow").html('');
            $("#czname").text("充值积分：");
            $("#czje").removeClass("hidden");
        }
    }
    function changetype(value){
        if(value=='1'){
            $("#he-name").text("核销金额：");
            $("#add_balance").attr("name","add_balance");
            $("#record_balance").attr("name","record_balance");
        }else if(value="2"){
            $("#he-name").text("核销积分：");
            $("#add_balance").attr("name","bonus");
            $("#record_balance").attr("name","record_bonus");
        }
    }
    function getDatas(val){
        var url= "{:url('pay/requestname')}";
        $.ajax({
            url:url,
            type:"post",
            data:{
                merchant:val
            },
            success:function(data){
                if(data!=""){
                    var list = "";
                    for(var i=0;i<data.length;i++){
                        list+="<li>"+data[i].merchant+"</li>";
                    }
                    $(".searchlist ul").html(list);
                    $(".searchlist").removeClass("hide");
                }else{
                    $(".searchlist ul").html('');
                    $(".searchlist").addClass("hide");
                }
            }
        })
    }
    function hexiao(url,id,btn){
        $("#"+btn).attr("disabled","disabled");
        $.ajax({
            url:url,
            type:"post",
            data:$("#"+id).serialize(),
            success:function(data){
                console.log(data);
//                return;
                if(data.code==0){
                    layer.msg(data.message,{icon:1,time:1000});
                    setTimeout("window.location.reload()",1000)
                    return false;
                }else{
                    $("#"+btn).removeAttr("disabled");
                    layer.alert(data.message,{icon:7});
                    return false;
                }
            }
        })
    }
    $(function(){
        //        获取充值说明
        $("#cz").on('change','#czme',function(){
            // console.log('asdf');
            var val = $(this).val();
            var zs = $(this).find("option:selected").attr("data-zs");
            var zsnew = $(this).find("option:selected").attr("data-zsnew");
            var money = $(this).find("option:selected").attr("data-money");
            var html = "";
            if(val){
                $("#czsm-wrap").removeClass("hidden");
                $("#czje").addClass("hidden");
            }else{
                $("#czsm-wrap").addClass("hidden");
                $("#czje").removeClass("hidden");
            }
            if(money){
                money="赠送金额："+money+"<br/>"
            }
            if(zs){
                zs = "赠送卡券："+zs;
            }


            $("#czsm").html(money+zs+zsnew);
        });
        $("#czModal").on('show.bs.modal',function () {
            var id = $(event.target).attr("data-id");
            $("#czcard-id").val(id);
        });
//        核销方法
        $("#hexiaoModal").on('show.bs.modal',function () {
            var id = $(event.target).attr("data-id");
            var type = $(event.target).attr("data-type");
            $("#card-id").val(id);
            $("#modal-type").val(type);
            if(type==1){
                $("#hexiaoModalLabel").text("会员卡充值");
            }else if(type==2){
                $("#hexiaoModalLabel").text("会员卡核销");
            }
        });
        $("#hexiaoModal").on('hide.bs.modal',function () {
            $("#card-id").val("");
            $("#he-md").val("");
            $("#record_bonus ").val("");
            $("#add_bonus ").val("");
        });



    })
</script>
<script>
    $(function () {
        $('#e_birthday').datetimepicker({
            startDate:'1960-01-01',
            minView: "month", //选择日期后，不会再跳转去选择时分秒
            language: 'zh-CN',
            format: 'yyyy-mm-dd',
            todayBtn: 1,
            autoclose: 1,
            todayHighlight: true,
        }).on('changeDate', function (ev) {
            var starttime = $('#e_birthday').val();

            if (starttime != "" && endtime != "") {
                var startD = new Date(Date.parse(starttime.replace(/-/g, "/")));
                var endD = new Date(Date.parse(endtime.replace(/-/g, "/")));


            }
        });

    });

</script>
</body>


</html>
